<?php

namespace app\admin\model;

use think\Model;

class Files extends Model
{
    public function getFilePathAttr($val)
    {
        return addHost($val);
    }
    public static function list()
    {
        $param = input();
        $list = self::order('id desc');
        if (!empty($param['file_name'])) {
            $file_name = $param['file_name'];
            $list->where('file_name', 'like', "%$file_name%");
        }
        if (!empty($param['user_id'])) {
            $list->where('user_id', $param['user_id']);
        }
        if (!empty($param['type'])) {
            $list->where('type', $param['type']);
        }

        $list = $list->paginate(10);
        return $list;
    }
}
